{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from pandas import DataFrame,Series\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "data": {
      "text/plain": "     萼片长度  萼片宽度  花瓣长度  花瓣宽度      物种\n0     5.1   3.5   1.4   0.2     山鸢尾\n1     4.9   3.0   1.4   0.2     山鸢尾\n2     4.7   3.2   1.3   0.2     山鸢尾\n3     4.6   3.1   1.5   0.2     山鸢尾\n4     5.0   3.6   1.4   0.2     山鸢尾\n..    ...   ...   ...   ...     ...\n145   6.7   3.0   5.2   2.3  维吉尼亚鸢尾\n146   6.3   2.5   5.0   1.9  维吉尼亚鸢尾\n147   6.5   3.0   5.2   2.0  维吉尼亚鸢尾\n148   6.2   3.4   5.4   2.3  维吉尼亚鸢尾\n149   5.9   3.0   5.1   1.8  维吉尼亚鸢尾\n\n[150 rows x 5 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>萼片长度</th>\n      <th>萼片宽度</th>\n      <th>花瓣长度</th>\n      <th>花瓣宽度</th>\n      <th>物种</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>5.1</td>\n      <td>3.5</td>\n      <td>1.4</td>\n      <td>0.2</td>\n      <td>山鸢尾</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>4.9</td>\n      <td>3.0</td>\n      <td>1.4</td>\n      <td>0.2</td>\n      <td>山鸢尾</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>4.7</td>\n      <td>3.2</td>\n      <td>1.3</td>\n      <td>0.2</td>\n      <td>山鸢尾</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>4.6</td>\n      <td>3.1</td>\n      <td>1.5</td>\n      <td>0.2</td>\n      <td>山鸢尾</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>5.0</td>\n      <td>3.6</td>\n      <td>1.4</td>\n      <td>0.2</td>\n      <td>山鸢尾</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>145</th>\n      <td>6.7</td>\n      <td>3.0</td>\n      <td>5.2</td>\n      <td>2.3</td>\n      <td>维吉尼亚鸢尾</td>\n    </tr>\n    <tr>\n      <th>146</th>\n      <td>6.3</td>\n      <td>2.5</td>\n      <td>5.0</td>\n      <td>1.9</td>\n      <td>维吉尼亚鸢尾</td>\n    </tr>\n    <tr>\n      <th>147</th>\n      <td>6.5</td>\n      <td>3.0</td>\n      <td>5.2</td>\n      <td>2.0</td>\n      <td>维吉尼亚鸢尾</td>\n    </tr>\n    <tr>\n      <th>148</th>\n      <td>6.2</td>\n      <td>3.4</td>\n      <td>5.4</td>\n      <td>2.3</td>\n      <td>维吉尼亚鸢尾</td>\n    </tr>\n    <tr>\n      <th>149</th>\n      <td>5.9</td>\n      <td>3.0</td>\n      <td>5.1</td>\n      <td>1.8</td>\n      <td>维吉尼亚鸢尾</td>\n    </tr>\n  </tbody>\n</table>\n<p>150 rows × 5 columns</p>\n</div>"
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(\"../data/iris.csv\")\n",
    "df"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [
    {
     "data": {
      "text/plain": "             action_type combined_shot_type  game_event_id   game_id      lat  \\\n0              Jump Shot          Jump Shot             10  20000012  33.9723   \n1              Jump Shot          Jump Shot             12  20000012  34.0443   \n2              Jump Shot          Jump Shot             35  20000012  33.9093   \n3              Jump Shot          Jump Shot             43  20000012  33.8693   \n4      Driving Dunk Shot               Dunk            155  20000012  34.0443   \n...                  ...                ...            ...       ...      ...   \n30692          Jump Shot          Jump Shot            397  49900088  33.9963   \n30693           Tip Shot           Tip Shot            398  49900088  34.0443   \n30694  Running Jump Shot          Jump Shot            426  49900088  33.8783   \n30695          Jump Shot          Jump Shot            448  49900088  33.7773   \n30696          Jump Shot          Jump Shot            471  49900088  33.9723   \n\n       loc_x  loc_y       lon  minutes_remaining  period  ...       shot_type  \\\n0        167     72 -118.1028                 10       1  ...  2PT Field Goal   \n1       -157      0 -118.4268                 10       1  ...  2PT Field Goal   \n2       -101    135 -118.3708                  7       1  ...  2PT Field Goal   \n3        138    175 -118.1318                  6       1  ...  2PT Field Goal   \n4          0      0 -118.2698                  6       2  ...  2PT Field Goal   \n...      ...    ...       ...                ...     ...  ...             ...   \n30692      1     48 -118.2688                  6       4  ...  2PT Field Goal   \n30693      0      0 -118.2698                  6       4  ...  2PT Field Goal   \n30694   -134    166 -118.4038                  3       4  ...  2PT Field Goal   \n30695     31    267 -118.2388                  2       4  ...  3PT Field Goal   \n30696      1     72 -118.2688                  0       4  ...  2PT Field Goal   \n\n              shot_zone_area        shot_zone_basic  shot_zone_range  \\\n0              Right Side(R)              Mid-Range        16-24 ft.   \n1               Left Side(L)              Mid-Range         8-16 ft.   \n2       Left Side Center(LC)              Mid-Range        16-24 ft.   \n3      Right Side Center(RC)              Mid-Range        16-24 ft.   \n4                  Center(C)        Restricted Area  Less Than 8 ft.   \n...                      ...                    ...              ...   \n30692              Center(C)  In The Paint (Non-RA)  Less Than 8 ft.   \n30693              Center(C)        Restricted Area  Less Than 8 ft.   \n30694   Left Side Center(LC)              Mid-Range        16-24 ft.   \n30695              Center(C)      Above the Break 3          24+ ft.   \n30696              Center(C)  In The Paint (Non-RA)  Less Than 8 ft.   \n\n          team_id           team_name   game_date      matchup opponent  \\\n0      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n1      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n2      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n3      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n4      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n...           ...                 ...         ...          ...      ...   \n30692  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30693  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30694  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30695  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30696  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n\n       shot_id  \n0            1  \n1            2  \n2            3  \n3            4  \n4            5  \n...        ...  \n30692    30693  \n30693    30694  \n30694    30695  \n30695    30696  \n30696    30697  \n\n[30697 rows x 25 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>action_type</th>\n      <th>combined_shot_type</th>\n      <th>game_event_id</th>\n      <th>game_id</th>\n      <th>lat</th>\n      <th>loc_x</th>\n      <th>loc_y</th>\n      <th>lon</th>\n      <th>minutes_remaining</th>\n      <th>period</th>\n      <th>...</th>\n      <th>shot_type</th>\n      <th>shot_zone_area</th>\n      <th>shot_zone_basic</th>\n      <th>shot_zone_range</th>\n      <th>team_id</th>\n      <th>team_name</th>\n      <th>game_date</th>\n      <th>matchup</th>\n      <th>opponent</th>\n      <th>shot_id</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>10</td>\n      <td>20000012</td>\n      <td>33.9723</td>\n      <td>167</td>\n      <td>72</td>\n      <td>-118.1028</td>\n      <td>10</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Right Side(R)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>12</td>\n      <td>20000012</td>\n      <td>34.0443</td>\n      <td>-157</td>\n      <td>0</td>\n      <td>-118.4268</td>\n      <td>10</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Left Side(L)</td>\n      <td>Mid-Range</td>\n      <td>8-16 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>35</td>\n      <td>20000012</td>\n      <td>33.9093</td>\n      <td>-101</td>\n      <td>135</td>\n      <td>-118.3708</td>\n      <td>7</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Left Side Center(LC)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>43</td>\n      <td>20000012</td>\n      <td>33.8693</td>\n      <td>138</td>\n      <td>175</td>\n      <td>-118.1318</td>\n      <td>6</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Right Side Center(RC)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>Driving Dunk Shot</td>\n      <td>Dunk</td>\n      <td>155</td>\n      <td>20000012</td>\n      <td>34.0443</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-118.2698</td>\n      <td>6</td>\n      <td>2</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>Restricted Area</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>5</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>30692</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>397</td>\n      <td>49900088</td>\n      <td>33.9963</td>\n      <td>1</td>\n      <td>48</td>\n      <td>-118.2688</td>\n      <td>6</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>In The Paint (Non-RA)</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30693</td>\n    </tr>\n    <tr>\n      <th>30693</th>\n      <td>Tip Shot</td>\n      <td>Tip Shot</td>\n      <td>398</td>\n      <td>49900088</td>\n      <td>34.0443</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-118.2698</td>\n      <td>6</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>Restricted Area</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30694</td>\n    </tr>\n    <tr>\n      <th>30694</th>\n      <td>Running Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>426</td>\n      <td>49900088</td>\n      <td>33.8783</td>\n      <td>-134</td>\n      <td>166</td>\n      <td>-118.4038</td>\n      <td>3</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Left Side Center(LC)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30695</td>\n    </tr>\n    <tr>\n      <th>30695</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>448</td>\n      <td>49900088</td>\n      <td>33.7773</td>\n      <td>31</td>\n      <td>267</td>\n      <td>-118.2388</td>\n      <td>2</td>\n      <td>4</td>\n      <td>...</td>\n      <td>3PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>Above the Break 3</td>\n      <td>24+ ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30696</td>\n    </tr>\n    <tr>\n      <th>30696</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>471</td>\n      <td>49900088</td>\n      <td>33.9723</td>\n      <td>1</td>\n      <td>72</td>\n      <td>-118.2688</td>\n      <td>0</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>In The Paint (Non-RA)</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30697</td>\n    </tr>\n  </tbody>\n</table>\n<p>30697 rows × 25 columns</p>\n</div>"
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1 = pd.read_csv(\"../data/kobe.csv\",sep=\",\",header=[0])\n",
    "df1\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [],
   "source": [
    "df1.to_csv(\"../data/iris1.csv\",sep=\",\",header=True,index=True)\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "outputs": [
    {
     "data": {
      "text/plain": "             action_type combined_shot_type  game_event_id   game_id      lat  \\\n0              Jump Shot          Jump Shot             10  20000012  33.9723   \n1              Jump Shot          Jump Shot             12  20000012  34.0443   \n2              Jump Shot          Jump Shot             35  20000012  33.9093   \n3              Jump Shot          Jump Shot             43  20000012  33.8693   \n4      Driving Dunk Shot               Dunk            155  20000012  34.0443   \n...                  ...                ...            ...       ...      ...   \n30692          Jump Shot          Jump Shot            397  49900088  33.9963   \n30693           Tip Shot           Tip Shot            398  49900088  34.0443   \n30694  Running Jump Shot          Jump Shot            426  49900088  33.8783   \n30695          Jump Shot          Jump Shot            448  49900088  33.7773   \n30696          Jump Shot          Jump Shot            471  49900088  33.9723   \n\n       loc_x  loc_y       lon  minutes_remaining  period  ...       shot_type  \\\n0        167     72 -118.1028                 10       1  ...  2PT Field Goal   \n1       -157      0 -118.4268                 10       1  ...  2PT Field Goal   \n2       -101    135 -118.3708                  7       1  ...  2PT Field Goal   \n3        138    175 -118.1318                  6       1  ...  2PT Field Goal   \n4          0      0 -118.2698                  6       2  ...  2PT Field Goal   \n...      ...    ...       ...                ...     ...  ...             ...   \n30692      1     48 -118.2688                  6       4  ...  2PT Field Goal   \n30693      0      0 -118.2698                  6       4  ...  2PT Field Goal   \n30694   -134    166 -118.4038                  3       4  ...  2PT Field Goal   \n30695     31    267 -118.2388                  2       4  ...  3PT Field Goal   \n30696      1     72 -118.2688                  0       4  ...  2PT Field Goal   \n\n              shot_zone_area        shot_zone_basic  shot_zone_range  \\\n0              Right Side(R)              Mid-Range        16-24 ft.   \n1               Left Side(L)              Mid-Range         8-16 ft.   \n2       Left Side Center(LC)              Mid-Range        16-24 ft.   \n3      Right Side Center(RC)              Mid-Range        16-24 ft.   \n4                  Center(C)        Restricted Area  Less Than 8 ft.   \n...                      ...                    ...              ...   \n30692              Center(C)  In The Paint (Non-RA)  Less Than 8 ft.   \n30693              Center(C)        Restricted Area  Less Than 8 ft.   \n30694   Left Side Center(LC)              Mid-Range        16-24 ft.   \n30695              Center(C)      Above the Break 3          24+ ft.   \n30696              Center(C)  In The Paint (Non-RA)  Less Than 8 ft.   \n\n          team_id           team_name   game_date      matchup opponent  \\\n0      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n1      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n2      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n3      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n4      1610612747  Los Angeles Lakers  2000-10-31    LAL @ POR      POR   \n...           ...                 ...         ...          ...      ...   \n30692  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30693  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30694  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30695  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n30696  1610612747  Los Angeles Lakers  2000-06-19  LAL vs. IND      IND   \n\n       shot_id  \n0            1  \n1            2  \n2            3  \n3            4  \n4            5  \n...        ...  \n30692    30693  \n30693    30694  \n30694    30695  \n30695    30696  \n30696    30697  \n\n[30697 rows x 25 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>action_type</th>\n      <th>combined_shot_type</th>\n      <th>game_event_id</th>\n      <th>game_id</th>\n      <th>lat</th>\n      <th>loc_x</th>\n      <th>loc_y</th>\n      <th>lon</th>\n      <th>minutes_remaining</th>\n      <th>period</th>\n      <th>...</th>\n      <th>shot_type</th>\n      <th>shot_zone_area</th>\n      <th>shot_zone_basic</th>\n      <th>shot_zone_range</th>\n      <th>team_id</th>\n      <th>team_name</th>\n      <th>game_date</th>\n      <th>matchup</th>\n      <th>opponent</th>\n      <th>shot_id</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>10</td>\n      <td>20000012</td>\n      <td>33.9723</td>\n      <td>167</td>\n      <td>72</td>\n      <td>-118.1028</td>\n      <td>10</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Right Side(R)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>12</td>\n      <td>20000012</td>\n      <td>34.0443</td>\n      <td>-157</td>\n      <td>0</td>\n      <td>-118.4268</td>\n      <td>10</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Left Side(L)</td>\n      <td>Mid-Range</td>\n      <td>8-16 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>35</td>\n      <td>20000012</td>\n      <td>33.9093</td>\n      <td>-101</td>\n      <td>135</td>\n      <td>-118.3708</td>\n      <td>7</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Left Side Center(LC)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>43</td>\n      <td>20000012</td>\n      <td>33.8693</td>\n      <td>138</td>\n      <td>175</td>\n      <td>-118.1318</td>\n      <td>6</td>\n      <td>1</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Right Side Center(RC)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>Driving Dunk Shot</td>\n      <td>Dunk</td>\n      <td>155</td>\n      <td>20000012</td>\n      <td>34.0443</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-118.2698</td>\n      <td>6</td>\n      <td>2</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>Restricted Area</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-10-31</td>\n      <td>LAL @ POR</td>\n      <td>POR</td>\n      <td>5</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>30692</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>397</td>\n      <td>49900088</td>\n      <td>33.9963</td>\n      <td>1</td>\n      <td>48</td>\n      <td>-118.2688</td>\n      <td>6</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>In The Paint (Non-RA)</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30693</td>\n    </tr>\n    <tr>\n      <th>30693</th>\n      <td>Tip Shot</td>\n      <td>Tip Shot</td>\n      <td>398</td>\n      <td>49900088</td>\n      <td>34.0443</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-118.2698</td>\n      <td>6</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>Restricted Area</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30694</td>\n    </tr>\n    <tr>\n      <th>30694</th>\n      <td>Running Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>426</td>\n      <td>49900088</td>\n      <td>33.8783</td>\n      <td>-134</td>\n      <td>166</td>\n      <td>-118.4038</td>\n      <td>3</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Left Side Center(LC)</td>\n      <td>Mid-Range</td>\n      <td>16-24 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30695</td>\n    </tr>\n    <tr>\n      <th>30695</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>448</td>\n      <td>49900088</td>\n      <td>33.7773</td>\n      <td>31</td>\n      <td>267</td>\n      <td>-118.2388</td>\n      <td>2</td>\n      <td>4</td>\n      <td>...</td>\n      <td>3PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>Above the Break 3</td>\n      <td>24+ ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30696</td>\n    </tr>\n    <tr>\n      <th>30696</th>\n      <td>Jump Shot</td>\n      <td>Jump Shot</td>\n      <td>471</td>\n      <td>49900088</td>\n      <td>33.9723</td>\n      <td>1</td>\n      <td>72</td>\n      <td>-118.2688</td>\n      <td>0</td>\n      <td>4</td>\n      <td>...</td>\n      <td>2PT Field Goal</td>\n      <td>Center(C)</td>\n      <td>In The Paint (Non-RA)</td>\n      <td>Less Than 8 ft.</td>\n      <td>1610612747</td>\n      <td>Los Angeles Lakers</td>\n      <td>2000-06-19</td>\n      <td>LAL vs. IND</td>\n      <td>IND</td>\n      <td>30697</td>\n    </tr>\n  </tbody>\n</table>\n<p>30697 rows × 25 columns</p>\n</div>"
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2 = pd.read_table('../data/iris1.csv',sep=\",\",index_col=[0])\n",
    "df2"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "outputs": [
    {
     "data": {
      "text/plain": "   Python  Java  Go   C  JS\n0      49     2  35  39  43\n1       3    32  10   6  14\n2      40     4  38  45   1\n3      24    45  38  38  38\n4      45    17  23  24  32\n5      31    19   0   1  18\n6       5     0  24  28  37\n7       7    46   2   2  42\n8      10    49   4  17   8\n9      15    26  12   9  19",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Python</th>\n      <th>Java</th>\n      <th>Go</th>\n      <th>C</th>\n      <th>JS</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>49</td>\n      <td>2</td>\n      <td>35</td>\n      <td>39</td>\n      <td>43</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>3</td>\n      <td>32</td>\n      <td>10</td>\n      <td>6</td>\n      <td>14</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>40</td>\n      <td>4</td>\n      <td>38</td>\n      <td>45</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>24</td>\n      <td>45</td>\n      <td>38</td>\n      <td>38</td>\n      <td>38</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>45</td>\n      <td>17</td>\n      <td>23</td>\n      <td>24</td>\n      <td>32</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>31</td>\n      <td>19</td>\n      <td>0</td>\n      <td>1</td>\n      <td>18</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>5</td>\n      <td>0</td>\n      <td>24</td>\n      <td>28</td>\n      <td>37</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>7</td>\n      <td>46</td>\n      <td>2</td>\n      <td>2</td>\n      <td>42</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>10</td>\n      <td>49</td>\n      <td>4</td>\n      <td>17</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>15</td>\n      <td>26</td>\n      <td>12</td>\n      <td>9</td>\n      <td>19</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = np.random.randint(0, 50, size=(10,5))\n",
    "df = pd.DataFrame(data=data, columns=['Python','Java','Go','C','JS'])\n",
    "df\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "outputs": [],
   "source": [
    "df.to_excel(\"../data/test.xlsx\",index=False,sheet_name=\"Sheet2\")"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "outputs": [
    {
     "data": {
      "text/plain": "    A   B   C   D   E\n0  49   2  35  39  43\n1   3  32  10   6  14\n2  40   4  38  45   1\n3  24  45  38  38  38\n4  45  17  23  24  32\n5  31  19   0   1  18\n6   5   0  24  28  37\n7   7  46   2   2  42\n8  10  49   4  17   8\n9  15  26  12   9  19",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>A</th>\n      <th>B</th>\n      <th>C</th>\n      <th>D</th>\n      <th>E</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>49</td>\n      <td>2</td>\n      <td>35</td>\n      <td>39</td>\n      <td>43</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>3</td>\n      <td>32</td>\n      <td>10</td>\n      <td>6</td>\n      <td>14</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>40</td>\n      <td>4</td>\n      <td>38</td>\n      <td>45</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>24</td>\n      <td>45</td>\n      <td>38</td>\n      <td>38</td>\n      <td>38</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>45</td>\n      <td>17</td>\n      <td>23</td>\n      <td>24</td>\n      <td>32</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>31</td>\n      <td>19</td>\n      <td>0</td>\n      <td>1</td>\n      <td>18</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>5</td>\n      <td>0</td>\n      <td>24</td>\n      <td>28</td>\n      <td>37</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>7</td>\n      <td>46</td>\n      <td>2</td>\n      <td>2</td>\n      <td>42</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>10</td>\n      <td>49</td>\n      <td>4</td>\n      <td>17</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>15</td>\n      <td>26</td>\n      <td>12</td>\n      <td>9</td>\n      <td>19</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3 = pd.read_excel(\"../data/test.xlsx\",names=list('ABCDE'))\n",
    "df3"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [
    {
     "data": {
      "text/plain": "     Python  Pandas  PyTorch\n0        68      51       31\n1        66      67       51\n2       109      82       36\n3       139     133        4\n4       123     147      113\n..      ...     ...      ...\n145      98      43       11\n146     149      79       14\n147     111     113       15\n148      34     136        1\n149     116      58       26\n\n[150 rows x 3 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Python</th>\n      <th>Pandas</th>\n      <th>PyTorch</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>68</td>\n      <td>51</td>\n      <td>31</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>66</td>\n      <td>67</td>\n      <td>51</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>109</td>\n      <td>82</td>\n      <td>36</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>139</td>\n      <td>133</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>123</td>\n      <td>147</td>\n      <td>113</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>145</th>\n      <td>98</td>\n      <td>43</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>146</th>\n      <td>149</td>\n      <td>79</td>\n      <td>14</td>\n    </tr>\n    <tr>\n      <th>147</th>\n      <td>111</td>\n      <td>113</td>\n      <td>15</td>\n    </tr>\n    <tr>\n      <th>148</th>\n      <td>34</td>\n      <td>136</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>149</th>\n      <td>116</td>\n      <td>58</td>\n      <td>26</td>\n    </tr>\n  </tbody>\n</table>\n<p>150 rows × 3 columns</p>\n</div>"
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = np.random.randint(0,150,size=(150,3))\n",
    "df = pd.DataFrame(data=data, columns=['Python','Pandas','PyTorch'])\n",
    "df\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "outputs": [],
   "source": [
    "from sqlalchemy import create_engine\n",
    "conn = create_engine(\"mysql+pymysql://root:123456@localhost/db_16\")"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "outputs": [
    {
     "data": {
      "text/plain": "150"
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_sql(\"score\",con=conn,index=False,if_exists=\"append\")"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "outputs": [
    {
     "data": {
      "text/plain": "     Python  Pandas  PyTorch\n0        68      51       31\n1        66      67       51\n2       109      82       36\n3       139     133        4\n4       123     147      113\n..      ...     ...      ...\n295      98      43       11\n296     149      79       14\n297     111     113       15\n298      34     136        1\n299     116      58       26\n\n[300 rows x 3 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Python</th>\n      <th>Pandas</th>\n      <th>PyTorch</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>68</td>\n      <td>51</td>\n      <td>31</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>66</td>\n      <td>67</td>\n      <td>51</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>109</td>\n      <td>82</td>\n      <td>36</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>139</td>\n      <td>133</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>123</td>\n      <td>147</td>\n      <td>113</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>295</th>\n      <td>98</td>\n      <td>43</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>296</th>\n      <td>149</td>\n      <td>79</td>\n      <td>14</td>\n    </tr>\n    <tr>\n      <th>297</th>\n      <td>111</td>\n      <td>113</td>\n      <td>15</td>\n    </tr>\n    <tr>\n      <th>298</th>\n      <td>34</td>\n      <td>136</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>299</th>\n      <td>116</td>\n      <td>58</td>\n      <td>26</td>\n    </tr>\n  </tbody>\n</table>\n<p>300 rows × 3 columns</p>\n</div>"
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sql = \"select * from score\"\n",
    "df3 = pd.read_sql(sql=sql,con=conn)\n",
    "df3"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}